getApp();

var e = require("../../utils/config"), t = require("../../utils/request");

Page({
    data: {
        
        screenWidth: 0,
        screenHeight: 0,
        imgwidth: 0,
        imgheight: 0,
        bannerSrc: "",
        show: !1,
        indicatorDots: !0,
        loading: !0,
        bannerList: [],
        logoSrc: e.resourceRoot + "index-logo.png",
        headerTop: -100,
        swiperCurrent: 0,
        headerHeight: 0,
        headerButtonHeght: 0,
        isShow: !1
    },
     
    swiperChange: function(e) {
        this.setData({
            swiperCurrent: e.detail.current
        });
    },
    onLoad: function(e) {
        var t = wx.getMenuButtonBoundingClientRect(), 
        n = wx.getSystemInfoSync().statusBarHeight;
         this.setData({
            headerHeight: t.top,
            headerButtonHeght: t.height
        });
         this.initindex(e);
    },
    onShow: function() {
        //  isLogin()
        this.getBanner()
        
    },
    onPageScroll: function(e) {
        e.scrollTop > this.data.headerHeight ? this.setData({
            isShow: !0
        }) : this.setData({
            isShow: !1
        });
    },
    initindex: function(e) {
        var t = this;
        if (wx.getSystemInfo({
            success: function(e) {
                t.setData({
                    screenHeight: e.windowHeight,
                    screenWidth: e.windowWidth
                });
            }
        }), Object.keys(e).length > 0) {
            
        } else t.setData({
            show: !0
        });
    },
     
    getBanner: function() {
        var i = this;
        t.post1('/wechat/home/banner', {}).then(function(t) {
            var n = [];
            t.code && t.data && t.data.forEach(function(t) {
                t.url = t.coverjdurl, n.push(t);
            }), i.setData({
                bannerList: n
            }), n.length <= 1 && i.setData({
                indicatorDots: !1
            }), i.setData({
                loading: !1
            });
        });
    },
   
    onShareAppMessage: function() {
        return {
            title: "首页",
            path: "/pages/index/index"
        };
    },
    
    onPullDownRefresh: function() {
        wx.stopPullDownRefresh();
    }
});